﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common.Logging;
using WuDada.Core.Post;
using WuDada.Core.Post.Service;

public partial class Main : System.Web.UI.MasterPage
{
    private ILog m_Log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    private PostFactory m_PostFactory;
    private IPostService m_PostService;

    //首頁大圖廣告=20
    private int m_NodeId = 20;

    protected void Page_Load(object sender, EventArgs e)
    {
        m_PostFactory = new PostFactory();
        m_PostService = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            //講座介紹
            RepeaterBanner_Bind();
        }
    }

    private void RepeaterBanner_Bind()
    {
        DateTime? startDate = DateTime.Today;
        string sortField = "ShowDate";
        bool sortDesc = true;

        rpBanner.DataSource = m_PostService.GetPostListByNodeIdWithCloseDate(m_NodeId, true, startDate, 0, int.MaxValue, sortField, sortDesc);
        rpBanner.DataBind();
    }
}
